package tv.dyndns.kishibe.server;

import java.util.List;
import java.util.Map;
import java.util.Set;

import tv.dyndns.kishibe.client.packet.PacketBbsResponse;
import tv.dyndns.kishibe.client.packet.PacketBbsThread;
import tv.dyndns.kishibe.client.packet.PacketChatData;
import tv.dyndns.kishibe.client.packet.PacketLinkData;
import tv.dyndns.kishibe.client.packet.PacketProblemCreationLog;
import tv.dyndns.kishibe.client.packet.PacketProblemData;
import tv.dyndns.kishibe.client.packet.PacketProblemDataMinimum;
import tv.dyndns.kishibe.client.packet.PacketRankingData;
import tv.dyndns.kishibe.client.packet.PacketUserData;
import tv.dyndns.kishibe.client.packet.PacketWrongAnswer;
import tv.dyndns.kishibe.server.ProblemManager.PacketProblemDataMinimums;
import tv.dyndns.kishibe.server.relevance.SentencesProcessor;

public interface Database {
	public void addProblemIdsToReport(final int userCode, final int[] problemIds);

	public void removeProblemIdFromReport(int userCode, int problemID);

	public void clearProblemIdFromReport(int userCode);

	public PacketProblemData[] getUserProblemReport(int userCode);

	public PacketUserData getUserData(int userCode);

	public void setUserData(PacketUserData data);

	public PageView loadPageView();

	public void savePageView(PageView pageView);

	public List<PacketProblemDataMinimum> getMinimumProblemDatas();

	public PacketProblemDataMinimums getMinimumProblemDatasForThemeMode(String[] queries);

	public int addProblemData(PacketProblemData data);

	public void updateProblemData(PacketProblemData data);

	public void updateMinimumProblemData(PacketProblemDataMinimum data);

	public PacketProblemData[] getProblemData(List<Integer> ids);

	public PacketProblemData[] searchProblem(String query, String creater, int genre, int type, int randomFlag);

	public PacketProblemData[] searchSimilarProblemData(String query);

	public PacketProblemData[] searchProblemDataByCreater(String creater);

	public void addPlayerAnswers(int problemID, int type, List<String> answers);

	public PacketWrongAnswer[] getPlayerAnswers(int problemID);

	public void removePlayerAnswers(int problemID);

	public PacketRankingData[][] getRankingData();

	public Map<String, PacketRankingData[]> getThemeModeRankingData();

	public void addCreationLog(int problemID, int userCode, String machineIP);

	public void addIgnoreUserCode(int userCode, int targetUserCode);

	public void removeIgnoreUserCode(int userCode, int targetUserCode);

	public Set<Integer> getServerIgnoreUserCode();

	public void addServerIgnoreUserCode(int userCode);

	public void addChatLog(PacketChatData data);

	public Set<Integer> getLimitedUserCodes();

	public Set<String> getLimitedIps();

	public PacketProblemCreationLog[] getProblemCreationHistory(int problemId);

	public PacketBbsThread[] getBbsThread(int start, int count);

	public PacketBbsResponse[] getBbsResponses(int threadId, int count);

	public void buildBbsThread(PacketBbsThread thread, PacketBbsResponse response);

	public void writeToBbs(PacketBbsResponse response, boolean age);

	public int getNumberOfBbsThread();

	public boolean isUsedUserCode(int userCode);

	public void addLinkData(PacketLinkData linkData);

	public void updateLinkData(PacketLinkData linkData);

	public void removeLinkData(int id);

	public PacketLinkData[] getLinkDatas(int start, int count);

	public int getNumberOfLinkDatas();

	public int getNumberOfActiveUsers();

	public Map<Integer, List<Integer>> getRatingGroupedByPrefecture();

	public void addRatingHistory(int userCode, int rating);

	public int[] getRatingHistory(int userCode);

	public int[] getWholeRating();

	public PacketProblemData[] getAdsenseProblems(String query);

	public Map<String, List<String>> getThemeModeQuery();

	public void addThemeModeQuery(String theme, String query);

	public void removeThemeModeQuery(String theme, String query);

	public void updateThemeModeScore(int userCode, String theme, int score);

	public void voteToProblem(int problemId, boolean good, String feedback);

	public void clearProblemFeedback(int problemId);

	public List<String> getProblemFeedback(int problemId);

	public void processProblems(SentencesProcessor sentencesProcessor);

	public PacketProblemData[] getLastestProblems();

	public Map<Integer, Integer> getThemeModeEditorsStatus();

	public void updateThemeModeEdtorsStatus(int userCode, int status);
}
